package com.vecspace.jsmodel;

import java.io.Serializable;

/**ZTree节点
 * @author: wanghua
 */
public class ZTreeNode implements Comparable<ZTreeNode>, Serializable {

	private static final long serialVersionUID = -7863344092226920451L;

	public ZTreeNode(){
		
	}
	
	public ZTreeNode(String id, String parentId, String name, String icon, Integer ordnum){
		this.id = id;
		this.pId = parentId;
		this.name = name;
		this.icon = icon;
		if(ordnum != null) {
			this.ordinalNumber = ordnum;
		}
	}
	
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	public String getpId() {
		return pId;
	}

	public void setpId(String pId) {
		this.pId = pId;
	}
	
	public boolean isChecked() {
		return checked;
	}
	public void setChecked(boolean checked) {
		this.checked = checked;
	}
	public boolean isChkDisabled() {
		return chkDisabled;
	}
	public void setChkDisabled(boolean chkDisabled) {
		this.chkDisabled = chkDisabled;
	}
	public boolean isHalfCheck() {
		return halfCheck;
	}
	public void setHalfCheck(boolean halfCheck) {
		this.halfCheck = halfCheck;
	}
	public String getIcon() {
		return icon;
	}
	public void setIcon(String icon) {
		this.icon = icon;
	}
	public String getIconClose() {
		return iconClose;
	}
	public void setIconClose(String iconClose) {
		this.iconClose = iconClose;
	}
	public String getIconOpen() {
		return iconOpen;
	}
	public void setIconOpen(String iconOpen) {
		this.iconOpen = iconOpen;
	}
	public String getIconSkin() {
		return iconSkin;
	}
	public void setIconSkin(String iconSkin) {
		this.iconSkin = iconSkin;
	}
	public boolean isHidden() {
		return isHidden;
	}
	public void setHidden(boolean isHidden) {
		this.isHidden = isHidden;
	}
	public boolean getIsParent() {
		return isParent;
	}
	public void setIsParent(boolean isParent) {
		this.isParent = isParent;
	}
	public String getName() {
		return name;
	}
	public void setName(String name) {
		this.name = name;
	}
	public boolean isNocheck() {
		return nocheck;
	}
	public void setNocheck(boolean nocheck) {
		this.nocheck = nocheck;
	}
	public boolean isOpen() {
		return open;
	}
	public void setOpen(boolean open) {
		this.open = open;
	}
	public String getTarget() {
		return target;
	}
	public void setTarget(String target) {
		this.target = target;
	}
	public String getUrl() {
		return url;
	}
	public void setUrl(String url) {
		this.url = url;
	}
	public String getTag() {
		return tag;
	}
	public void setTag(String tag) {
		this.tag = tag;
	}

	public int getOrdinalNumber() {
		return ordinalNumber;
	}

	public void setOrdinalNumber(Integer ordinalNumber) {
		if(ordinalNumber == null){
			this.ordinalNumber = 0;
		}else{
			this.ordinalNumber = ordinalNumber;
		}
	}

	public boolean isDelable() {
		return delable;
	}

	public void setDelable(boolean delable) {
		this.delable = delable;
	}

	public boolean isRenameable() {
		return renameable;
	}

	public void setRenameable(boolean renameable) {
		this.renameable = renameable;
	}

	public Object getAttr() {
		return attr;
	}

	public void setAttr(Object attr) {
		this.attr = attr;
	}

	private String id;
	private String pId;
	private boolean checked = false;
	private boolean chkDisabled = false;
	private boolean halfCheck = false;
	private String icon;
	private String iconClose;
	private String iconOpen;
	private String iconSkin;
	private boolean isHidden = false;
	private boolean isParent = false;
	private String name;
	private boolean nocheck = false;
	private boolean open = false;
	private String target;
	private String url;
	private String tag;
	private Object attr;

	private boolean delable = true;
	private boolean renameable=true;
	private int ordinalNumber;
	@Override
	public int compareTo(ZTreeNode obj) {
		if(obj == null) {
			return 1;
		}
		ZTreeNode node2 = (ZTreeNode)obj;
		if(this.ordinalNumber > node2.ordinalNumber) {
			return 1;
		} else if(this.ordinalNumber == node2.ordinalNumber) {
			return 0;
		} else {
			return -1;
		}
	}
}
